home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / hc / timebill.sit / Job Summary / stack.txt < prev   
Text File  |  1988-01-29  |  21KB  |  707 lines

  1. -- stack: in
  2. -- format: 8 (HyperCard 1)
  3. -- flags: 0x0 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=0 h=0
  9. -- scroll: x=0 y=0
  10. -- background count: 2
  11. -- first background id: 2627
  12. -- card count: 3
  13. -- first card id: 6568
  14. -- list block id: 3862
  15. -- print block id: 3509
  16. -- font table block id: 0
  17. -- style table block id: 0
  18. -- free block count: 0
  19. -- free size: 0 bytes
  20. -- total size: 29088 bytes
  21. -- stack block size: 16384 bytes
  22. -- created by hypercard version: 0x00000000
  23. -- compacted by hypercard version: 0x00000000
  24. -- modified by hypercard version: 0x00000000
  25. -- opened by hypercard version: 0x00000000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x0000220000002200
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0xCC003300CC003300
  30. -- patterns[4]: 0xCC883322CC883322
  31. -- patterns[5]: 0xEE88BB22EE88BB22
  32. -- patterns[6]: 0xEECCBB33EECCBB33
  33. -- patterns[7]: 0xFFCCFF33FFCCFF33
  34. -- patterns[8]: 0xFFEEFFBBFFEEFFBB
  35. -- patterns[9]: 0xFFFFFFBBFFFFFFBB
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x038448300C020101
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0x0
  67. ----- HyperTalk script -----
  68. on newCard
  69.   put the date into field "sumDate"
  70. end newCard
  71.  
  72. on startUp
  73.   play "choir" tempo 380 b3 c#4 d e f# g a#3 g4 f# e d c# d r f# r b r c# r b r a# r bw
  74.  
  75.   show field "credits"
  76.   wait 3 secs
  77.   show field "credits2"
  78.   wait 4 secs
  79.   hide field "credits2"
  80.   wait 1 secs
  81.   hide field "credits"
  82. end startUp
  83.  
  84. on openStack
  85.   hide message box
  86.   hide menuBar
  87.   hide tool window
  88.   hide pattern window
  89.   choose browse tool
  90.   set userLevel to 2
  91.   go last card of background 1
  92. end openStack
  93.  
  94.  
  95. on summarize
  96.   set the cursor to 4
  97.   put "yes" into sumTime
  98.   put "yes" into sumExp
  99.   put 1 into pg
  100.   put "no" into adjustSum
  101.   if the shiftKey is down then put "yes" into adjustSum
  102.  
  103.   put the date into endDay
  104.   put "1/1/88" into startDay
  105.   if the optionKey is down then
  106.     ask "Start summary at what date?" with startDay
  107.     if it is empty then
  108.       beep
  109.       exit summarize
  110.     end if
  111.     put it into startDay
  112.     ask "End summary at what date?" with endDay
  113.     if it is empty then
  114.       beep
  115.       exit summarize
  116.     end if
  117.     put it into endDay
  118.  
  119.   end if
  120.   put startDay into displayDate
  121.   put endDay into displayDate2
  122.   convert StartDay to secs
  123.   convert EndDay to secs
  124.   if adjustSum = "Yes" then
  125.     Answer "Summarize Time or Expense only?" with "Time" or "Expense" or "Cancel"
  126.     if it="cancel" then exit summarize
  127.     if it= "time" then
  128.       put "Yes" into SumTime
  129.       put "No" into sumExp
  130.     else
  131.       put "no" into sumTime
  132.       put "yes" into sumExp
  133.     end if
  134.   end if
  135.  
  136.   show message box
  137.   put "SUMMARIZING"
  138.   push this card
  139.   get long id of this card
  140.   put it into Q
  141.   Put "" into field "person"
  142.   Put "" into field "week"
  143.   Put "" into field "activity"
  144.   Put "" into field "hours"
  145.   Put "" into field "total$"
  146.   Put "" into field "totalhours"
  147.   Put "" into field "summarytotal"
  148.   Put "" into field "desc."
  149.   put the date into field "sumdate"
  150.  
  151.  
  152.  
  153.   if field "sumcode" is empty then
  154.     ask "Client code please?!"
  155.     put it into field  "sumcode"
  156.  
  157.   end if
  158.   put field "sumcode" into clientcode
  159.  
  160.   set lockScreen to true
  161.  
  162.   go card "rate scheme" --- get rate parameters
  163.   put field "expenseMark" into markUp
  164.   if hilite of background button "activity" is true then
  165.     put 2 into routine
  166.   end if
  167.   if hilite of background button "Person" is true then
  168.     if hilite of background button "Activity" is true then
  169.       put 3 into routine
  170.     else
  171.       put 1 into routine
  172.     end if
  173.   end if
  174.  
  175.   if sumTime = "yes" then
  176.  
  177.  
  178.  
  179.     if routine = 1 then ----by person
  180.  
  181.       put field "PersonBase" into BaseRate
  182.       put field "P1" into person1
  183.       put field "P2" into person2
  184.       put field "P3" into person3
  185.       put field "P4" into person4
  186.       put field "P5" into person5
  187.       put field "P6" into person6
  188.       put field "P7" into person7
  189.  
  190.  
  191.  
  192.       go stack "time sheet"
  193.  
  194.  
  195.       repeat with y=1 to the number of cards
  196.         go card y
  197.  
  198.         put "Summarizing time from"&& displayDate && "to" && displayDate2 &&"Page" && pg
  199.  
  200.         put field "weekendg" into compareDay
  201.         convert compareDay to secs
  202.         if compareDay < startDay or compareDay > endDay then next repeat
  203.  
  204.         repeat with s= 1 to the number of lines of field "clientcode"
  205.           go card y
  206.           If clientcode is in line s of field "clientcode" then
  207.  
  208.             put line s of field "description" into desc
  209.             put  line s  of field "hours" into hours
  210.             put field "weekendg"  into putDate
  211.             put  line s  of field "activitycode" into activitycode
  212.  
  213.             put  field "name"  into person
  214.             put 1 into PersonRate
  215.             if person is in person1 then
  216.               put second word of person1 into personRate
  217.             end if
  218.             if person is in person2 then
  219.               put second word of person2 into personRate
  220.             end if
  221.             if person is in person3 then
  222.               put second word of person3 into personRate
  223.             end if
  224.             if person is in person4 then
  225.               put second word of person4 into personRate
  226.             end if
  227.             if person is in person5 then
  228.               put second word of person5 into personRate
  229.             end if
  230.             if person is in person6 then
  231.               put second word of person6 into personRate
  232.             end if
  233.             if person is in person7 then
  234.               put second word of person7 into personRate
  235.             end if
  236.  
  237.  
  238.  
  239.             put (hours * (personRate * baseRate)) into actualsum
  240.  
  241.  
  242.  
  243.  
  244.  
  245.             push card
  246.             go  stack "job summary"
  247.             go to q
  248.             put number of lines of field "person" into counter
  249.             add 1 to counter
  250.             if counter > 20 then
  251.  
  252.               calculate
  253.               put field "totalhours" into HrTrans
  254.               put field "summarytotal" into sumTrans
  255.               put field "sumcode" into codeTrans
  256.               put "See nxt. pg." into field "summarytotal"
  257.               put "" into field "totalhours"
  258.               doMenu "new card"
  259.               get long id of this card
  260.               put it into q
  261.               add 1 to pg
  262.               put 1 into counter
  263.               put codeTrans into field "sumcode"
  264.               put hrTrans into field "totalhours"
  265.               put sumTrans into field "summarytotal"
  266.  
  267.             end if
  268.  
  269.  
  270.  
  271.             put person into line counter of field "Person"
  272.             put putDate into line counter of field "Week"
  273.             put activitycode into line counter of field "Activity"
  274.             put hours into line counter of field "Hours"
  275.             put desc into line counter of field "Desc."
  276.             set the numberFormat to "0.00"---dollars
  277.             put actualsum into line counter of field "total$"
  278.             set the numberFormat to "0"----normal
  279.  
  280.             pop card
  281.           end if
  282.  
  283.         end repeat
  284.  
  285.       end repeat
  286.  
  287.       go stack "job summary"
  288.       go to q
  289.  
  290.       if sumExp = "no" then
  291.  
  292.         if field "total$" is empty then
  293.           beep
  294.           answer "Something's screwy. Re-enter client code."
  295.           click at location of field "sumcode"
  296.           click at location of field "sumcode"
  297.           exit summarize
  298.         end if
  299.       end if
  300.  
  301.     end if
  302.  
  303.     if routine = 2 then    ----- based on activity
  304.  
  305.       put field "ac1" into billable1
  306.       put field "ac2" into billable2
  307.       put field "ac3" into billable3
  308.       put field "ac4" into billable4
  309.       put field "ac5" into billable5
  310.       put field "ac6" into billable6
  311.       put field "ac7" into billable7
  312.       put field "ac8" into billable8
  313.       put field "ac9" into billable9
  314.       put field "ac10" into billable10
  315.       put field "ac11" into billable11
  316.       put field "ac12" into billable12
  317.  
  318.       go stack "time sheet"
  319.  
  320.  
  321.       repeat with y=1 to the number of cards
  322.         put "Summarizing time from"&& displayDate && "to" && displayDate2 &&"Page" && pg
  323.         go card y
  324.  
  325.         put field "weekendg" into compareDay
  326.         convert compareDay to secs
  327.         if compareDay < startDay or compareDay > endDay then next repeat
  328.  
  329.         repeat with s= 1 to the number of lines of field "clientcode"
  330.           go card y
  331.  
  332.           If clientcode is in line s of field "clientcode" then
  333.  
  334.             put line s of field "description" into desc
  335.             put  line s  of field "hours" into hours
  336.             put field "weekendg"  into putDate
  337.             put  field "name"  into person
  338.             put  line s  of field "activitycode" into activitycode
  339.  
  340.             if activitycode =1 then put billable1 into billable
  341.             if activitycode =2 then put billable2 into billable
  342.             if activitycode =3 then put billable3 into billable
  343.             if activitycode =4 then put billable4 into billable
  344.             if activitycode =5 then put billable5 into billable
  345.             if activitycode =6 then put billable6 into billable
  346.             if activitycode =7 then put billable7 into billable
  347.             if activitycode =8 then put billable8 into billable
  348.             if activitycode =9 then put billable9 into billable
  349.             if activitycode =10 then put billable10 into billable
  350.             if activitycode =11 then put billable11 into billable
  351.             if activitycode =12 then put billable12 into billable
  352.             if activitycode >12 then put 0 into billable
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.             put (hours * billable) into actualsum
  361.  
  362.  
  363.  
  364.  
  365.  
  366.             push card
  367.             go  stack "job summary"
  368.             go to q
  369.             put number of lines of field "person" into counter
  370.             add 1 to counter
  371.  
  372.             if counter > 20 then
  373.  
  374.               calculate
  375.               put field "totalhours" into HrTrans
  376.               put field "summarytotal" into sumTrans
  377.               put field "sumcode" into codeTrans
  378.               put "See nxt. pg." into field "summarytotal"
  379.               put "" into field "totalhours"
  380.               doMenu "new card"
  381.               get long id of this card
  382.               put it into q
  383.               add 1 to pg
  384.               put 1 into counter
  385.               put codeTrans into field "sumcode"
  386.               put hrTrans into field "totalhours"
  387.               put sumTrans into field "summarytotal"
  388.  
  389.             end if
  390.  
  391.  
  392.  
  393.             put person into line counter of field "Person"
  394.             put putDate into line counter of field "Week"
  395.             put activitycode into line counter of field "Activity"
  396.             put hours into line counter of field "Hours"
  397.             put desc into line counter of field "Desc."
  398.             set the numberFormat to "0.00"---dollars
  399.             put actualsum into line counter of field "total$"
  400.             set the numberFormat to "0"----normal
  401.  
  402.             pop card
  403.           end if
  404.  
  405.         end repeat
  406.  
  407.       end repeat
  408.  
  409.       go stack "job summary"
  410.       go to q
  411.       if sumExp = "no" then
  412.  
  413.         if field "total$" is empty then
  414.           beep
  415.           answer "Something's screwy. Re-enter client code."
  416.           click at location of field "sumcode"
  417.           click at location of field "sumcode"
  418.           exit summarize
  419.         end if
  420.       end if
  421.     end if
  422.  
  423.  
  424.     if routine=3 then --- by both activity and person
  425.  
  426.       put field "ac1" into billable1
  427.       put field "ac2" into billable2
  428.       put field "ac3" into billable3
  429.       put field "ac4" into billable4
  430.       put field "ac5" into billable5
  431.       put field "ac6" into billable6
  432.       put field "ac7" into billable7
  433.       put field "ac8" into billable8
  434.       put field "ac9" into billable9
  435.       put field "ac10" into billable10
  436.       put field "ac11" into billable11
  437.       put field "ac12" into billable12
  438.  
  439.       put field "PersonBase" into BaseRate
  440.       put field "P1" into person1
  441.       put field "P2" into person2
  442.       put field "P3" into person3
  443.       put field "P4" into person4
  444.       put field "P5" into person5
  445.       put field "P6" into person6
  446.       put field "P7" into person7
  447.  
  448.       go stack "time sheet"
  449.  
  450.  
  451.       repeat with y=1 to the number of cards
  452.         put "Summarizing time from"&& displayDate && "to" && displayDate2 &&"Page" && pg
  453.         go card y
  454.  
  455.         put field "weekendg" into compareDay
  456.         convert compareDay to secs
  457.         if compareDay < startDay or compareDay > endDay then next repeat
  458.  
  459.         repeat with s= 1 to the number of lines of field "clientcode"
  460.           go card y
  461.           If clientcode is in line s of field "clientcode" then
  462.  
  463.             put line s of field "description" into desc
  464.             put  line s  of field "hours" into hours
  465.             put field "weekendg"  into putDate
  466.  
  467.             put  line s  of field "activitycode" into activitycode
  468.  
  469.             if activitycode =1 then put billable1 into billable
  470.             if activitycode =2 then put billable2 into billable
  471.             if activitycode =3 then put billable3 into billable
  472.             if activitycode =4 then put billable4 into billable
  473.             if activitycode =5 then put billable5 into billable
  474.             if activitycode =6 then put billable6 into billable
  475.             if activitycode =7 then put billable7 into billable
  476.             if activitycode =8 then put billable8 into billable
  477.             if activitycode =9 then put billable9 into billable
  478.             if activitycode =10 then put billable10 into billable
  479.             if activitycode =11 then put billable11 into billable
  480.             if activitycode =12 then put billable12 into billable
  481.             if activitycode >12 then put 0 into billable
  482.  
  483.  
  484.             put  field "name"  into person
  485.             put 1 into PersonRate
  486.             if person is in person1 then
  487.               put second word of person1 into personRate
  488.             end if
  489.             if person is in person2 then
  490.               put second word of person2 into personRate
  491.             end if
  492.             if person is in person3 then
  493.               put second word of person3 into personRate
  494.             end if
  495.             if person is in person4 then
  496.               put second word of person4 into personRate
  497.             end if
  498.             if person is in person5 then
  499.               put second word of person5 into personRate
  500.             end if
  501.             if person is in person6 then
  502.               put second word of person6 into personRate
  503.             end if
  504.             if person is in person7 then
  505.               put second word of person7 into personRate
  506.             end if
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.             put (hours * (billable * personRate)) into actualsum
  514.  
  515.  
  516.  
  517.  
  518.  
  519.             push card
  520.             go  stack "job summary"
  521.             go to q
  522.             put number of lines of field "person" into counter
  523.             add 1 to counter
  524.             if counter > 20 then
  525.  
  526.               calculate
  527.               put field "totalhours" into HrTrans
  528.               put field "summarytotal" into sumTrans
  529.               put field "sumcode" into codeTrans
  530.               put "See nxt. pg." into field "summarytotal"
  531.               put "" into field "totalhours"
  532.               doMenu "new card"
  533.               get long id of this card
  534.               put it into q
  535.               add 1 to pg
  536.               put 1 into counter
  537.               put codeTrans into field "sumcode"
  538.               put hrTrans into field "totalhours"
  539.               put sumTrans into field "summarytotal"
  540.  
  541.             end if
  542.  
  543.  
  544.  
  545.             put person into line counter of field "Person"
  546.             put putDate into line counter of field "Week"
  547.             put activitycode into line counter of field "Activity"
  548.             put hours into line counter of field "Hours"
  549.             put desc into line counter of field "Desc."
  550.             set the numberFormat to "0.00"---dollars
  551.             put actualsum into line counter of field "total$"
  552.             set the numberFormat to "0"----normal
  553.  
  554.             pop card
  555.           end if
  556.  
  557.         end repeat
  558.  
  559.       end repeat
  560.  
  561.       go stack "job summary"
  562.       go to q
  563.       if sumExp = "no" then
  564.  
  565.         if field "total$" is empty then
  566.           beep
  567.           answer "Something's screwy. Re-enter client code."
  568.           click at location of field "sumcode"
  569.           click at location of field "sumcode"
  570.           exit summarize
  571.         end if
  572.       end if
  573.     end if
  574.  
  575.     calculate
  576.   end if
  577.  
  578.   if sumExp = "yes" then
  579.  
  580.  
  581.     go stack "Expenses"
  582.  
  583.     repeat with y=1 to the number of cards
  584.       put "Summarizing expenses from"&& displayDate && "to" && displayDate2 &&"Page" && pg
  585.  
  586.       go card y
  587.  
  588.       put field "weekendg" into compareDay
  589.       convert compareDay to secs
  590.       if compareDay < startDay or compareDay > endDay then next repeat
  591.  
  592.       repeat with s= 1 to the number of lines of field "clientcode"
  593.         go card y
  594.  
  595.         If clientcode is in line s of field "clientcode" then
  596.  
  597.           put "EXPENSE:" && line s of field "description" into desc
  598.           put  line s  of field "amount" into actualsum
  599.           put actualsum + (actualsum * (MarkUp * .01)) into actualsum
  600.           put field "weekendg"  into putDate
  601.           put  field "name"  into person
  602.           put  "X" into activitycode
  603.           put "X" into hours
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.           push card
  611.           go  stack "job summary"
  612.           go to q
  613.           put number of lines of field "person" into counter
  614.           add 1 to counter
  615.  
  616.           if counter > 20 then
  617.  
  618.             calculate
  619.             put field "totalhours" into HrTrans
  620.             put field "summarytotal" into sumTrans
  621.             put field "sumcode" into codeTrans
  622.             put "See nxt. pg." into field "summarytotal"
  623.             put "" into field "totalhours"
  624.             doMenu "new card"
  625.             get long id of this card
  626.             put it into q
  627.             add 1 to pg
  628.             put 1 into counter
  629.             put codeTrans into field "sumcode"
  630.             put hrTrans into field "totalhours"
  631.             put sumTrans into field "summarytotal"
  632.  
  633.           end if
  634.  
  635.  
  636.  
  637.           put person into line counter of field "Person"
  638.           put putDate into line counter of field "Week"
  639.           put activitycode into line counter of field "Activity"
  640.           put hours into line counter of field "Hours"
  641.           put desc into line counter of field "Desc."
  642.           set the numberFormat to "0.00"
  643.           add 0 to actualsum
  644.           put actualsum into line counter of field "total$"
  645.           set the numberFormat to "0"
  646.           if field "summarytotal" is empty then
  647.             put 0 into field "summarytotal"
  648.           end if
  649.           set the numberFormat to "0.00"
  650.  
  651.           add actualsum to field "summarytotal"
  652.           set the numberFormat to "0"
  653.           pop card
  654.         end if
  655.  
  656.       end repeat
  657.  
  658.     end repeat
  659.  
  660.     go stack "job summary"
  661.     go to q
  662.     if field "total$" is empty then
  663.       beep
  664.       answer "Something's screwy. Re-enter client code."
  665.       click at location of field "sumcode"
  666.       click at location of field "sumcode"
  667.       exit summarize
  668.     end if
  669.   end if
  670.  
  671.  
  672. end summarize
  673.  
  674. on calculate
  675.   global sumExp
  676.   put 0 into total
  677.   put 0 into hours
  678.  
  679.   Repeat with c=1 to the number of lines of field "Total$"
  680.     put  line c of field "total$" into subtotal
  681.     add subtotal to total
  682.     put  line c of field "hours" into subhours
  683.     if subhours = "x" then put 0 into subhours
  684.     add subhours to hours
  685.  
  686.   end repeat
  687.   if field "summarytotal" is empty then
  688.     set the numberFormat to "0.0"
  689.     add 0 to hours
  690.     put hours into field "totalhours"
  691.     set the numberFormat to "0.00"
  692.     add 0 to total
  693.     put total into field "summarytotal"
  694.     set the numberFormat to "0"
  695.   else
  696.     add hours to field "totalhours"
  697.     set the numberFormat to "0.00"
  698.     add 0 to total
  699.     add total to field "summarytotal"
  700.     set the numberFormat to "0"
  701.   end if
  702. end calculate
  703.  
  704.  
  705.  
  706.  
  707.